<template>
  <h1>{{ title }}</h1>
  <p>count:{{ count }}</p>
  <p>用户名:{{ user.name }}</p>
   <p>年龄:{{ user.age }}</p>
   <div>
    <p v-for="item in scores" :key="item">{{ item }}</p>
   </div>
   <p>限定值是：{{ validNum }}</p>

</template>
<script setup>
const props = defineProps({
    title:{
        type:String,
        required:true,
    },
    count: {
        type:Number,
        default:0,//引用组件不传值的情况下默认值
    },
    user: {
        type:Object,
        default:()=>({
            name:"默认用户",
            age:18,
        }),
        // required:true,
 },
 scores:{
    type:Array,
    default:() => [], 
 },  
 validNum:{
    type:Number,
    validator:(value) =>
     value >= 0 && value <= 100,
 },
});
</script>

<style>

</style>